import axios from "@/utils/request.js";

/**
 * 上传证书
 * @param certificateForm
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const certificateUploadService = (certificateForm) => {
  return axios.post("/certificateInfo/add",certificateForm)
}

/**
 * 分页查询证书
 * @param currentPage
 * @param pageSize
 * @param certificateNameInput
 * @param userNameInput
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const certificateSelectService = (currentPage,pageSize,certificateName,userName) => {
  return axios.get("/certificateInfo/loadDataList",{params:{
      currentPage,pageSize,certificateName,userName
    }})
}

/**
 * 根据证书id删除证书（以及删除后端的文件）
 * @param certificateId
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const certificateDeleteService = (certificateIds) => {
  return axios.post("/certificateInfo/deleteCertificateInfoByCertificateId", certificateIds)
}

/**
 * 查询所有证书数量 （用于echarts图渲染）
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const certificateCountAllService = () => {
  return axios.get("/certificate/countAll")
}
